package com.ssyt.hiring.web.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.ssyt.cdp.common.Constants;
import com.ssyt.cdp.common.PageModel;
import com.ssyt.hiring.entity.PositionEntity;
import com.ssyt.hiring.web.service.PositionService;

@Controller
@Scope("prototype")
public class PositionAction {

	@Autowired
	private PositionService positionService;
	private PageModel<PositionEntity> pageModel;
	private int pageNo;
	private int pageSize;
	private String queryStr;

	public String listAll() {
		if (pageNo == 0) {
			pageNo = Constants.FIRST_PAGE;
		}
		if (pageSize == 0) {
			pageSize = Constants.DEFAULT_PAGE_SIZE;
		}
		pageModel = positionService.listAll(queryStr, pageNo, pageSize);
		return "listAll";
	}

	public PositionService getPositionService() {
		return positionService;
	}

	public void setPositionService(PositionService positionService) {
		this.positionService = positionService;
	}

	public PageModel<PositionEntity> getPageModel() {
		return pageModel;
	}

	public void setPageModel(PageModel<PositionEntity> pageModel) {
		this.pageModel = pageModel;
	}

	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public String getQueryStr() {
		return queryStr;
	}

	public void setQueryStr(String queryStr) {
		this.queryStr = queryStr;
	}

}
